package com.longteng.diamond.dao;

import com.longteng.diamond.domain.InterfaceScript;
import org.apache.ibatis.annotations.*;

/**
 * Created by Administrator
 * DATE : 2018/8/12
 * TIME : 16:23
 * PROJECT : java-lesson
 * PACKAGE : com.longteng.lesson
 *
 * @author <a href="mailto:taki@qq.com">Administrator</a>
 */
@Mapper
public interface InterfaceScriptMapper {
    /**
     * 根据mock接口id获取脚本
     * @param interfaceMockId
     * @return InterfaceScript
     * */
    @Select("select * from interface_script where interfaceMockId =#{interfaceMockId}")
    public InterfaceScript getInterfaceScript(@Param("interfaceMockId") Integer interfaceMockId);
    /**
     * 修改脚本
     * @param interfaceScript
     * @return void
     * */
    @Update("update interface_script set script=#{script} where interfaceMockId =#{interfaceMockId}")
    public void updateScript(InterfaceScript interfaceScript);
    /**
     * 新增脚本
     * @param interfaceScript
     * @return void
     * */
    @Insert("insert into interface_script(interfaceMockId,script,debug) values(#{interfaceMockId},#{script},false)")
    public void addScript(InterfaceScript interfaceScript);
    /**
     * 修改调试状态
     * @param interfaceScript
     * @return void
     * */
    @Update("update interface_script set debug=#{debug} where interfaceMockId =#{interfaceMockId}")
    public void updateDebugStatus(InterfaceScript interfaceScript);
}
